package com.tao.common.config;


import com.tao.common.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;

@Slf4j
@Configuration
public class RedisConfig {

    @Bean
    @ConditionalOnProperty(prefix = "spring.redis", name = "host")
    public RedisUtils redisUtils(StringRedisTemplate redisTemplate){
        log.info("RedisUtils启动");
        return new RedisUtils(redisTemplate);
    }
}
